﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.Common;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Configuration;
using Database;


namespace Database
{
    class ConnectToDatabase
    {
        public SqlConnection con;
        private string strcon;

        public SqlConnection GetConnect()
        {
            try
            {
                strcon = @"Data Source=CRISTIANO-PC\SQLEXPRESS2005;Initial Catalog=maytinhxachtay;Integrated Security=SSPI;";
                con = new SqlConnection(strcon);
                con.Open();
            }
            catch
            {
                con = null;
            }
            return con;
        }

        public void CloseConnect()
        {
            try
            {
                con.Close();
            }
            catch
            {

            }
        }
    }
}
